/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.strategy.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pigx.strategy.dto.StrategyContractAddDTO;
import com.pig4cloud.pigx.strategy.dto.StrategyContractConditionDTO;
import com.pig4cloud.pigx.strategy.dto.StrategyContractEditDTO;
import com.pig4cloud.pigx.strategy.entity.StrategyContract;
import com.pig4cloud.pigx.strategy.vo.StrategyContractAppDetailVO;
import com.pig4cloud.pigx.strategy.vo.StrategyContractAppVO;
import com.pig4cloud.pigx.strategy.vo.StrategyContractProfitVO;
import com.pig4cloud.pigx.strategy.vo.StrategyContractVO;

import java.util.List;

/**
 * 策略-合约
 *
 * @since 2022-11-24 10:39:27
 */
public interface StrategyContractService extends IService<StrategyContract> {

    /**
     * 根据产品id统计相关策略的条数
     *
     * @param productId 产品id
     * @return {@link Long}
     * @since 2022/11/26 14:48
     */
    Long countByProductId(Long productId);

    /**
     * 分页查询
     *
     * @param page      分页条件
     * @param condition 查询条件
     * @return {@link Page< StrategyContractVO>}
     * @since 2022/11/24 10:48
     */
    Page<StrategyContractVO> page(Page<StrategyContract> page, StrategyContract condition);

    /**
     * 新增
     *
     * @param dto 数据
     * @since 2022/11/24 11:31
     */
    void add(StrategyContractAddDTO dto);

    /**
     * 修改
     *
     * @param dto 数据
     * @since 2022/11/24 11:31
     */
    void edit(StrategyContractEditDTO dto);

    /**
     * 根据id逻辑删除
     *
     * @param id id
     * @since 2022/11/24 11:31
     */
    void del(Long id);

    /**
     * 禁用策略
     *
     * @param id id
     * @since 2022/11/26 17:57
     */
    void disable(Long id);

    /**
     * 启用策略
     *
     * @param id id
     * @since 2022/11/26 17:57
     */
    void enable(Long id);

    /**
     * App端开启策略
     *
     * @param id id
     * @since 2022/12/3 19:43
     */
    void appOpen(Long id);

    /**
     * App端关闭策略
     *
     * @param id id
     * @since 2022/12/3 20:05
     */
    void appClose(Long id);

    /**
     * 初始化redis缓存
     */
    void initRedis();

    /**
     * app端查询列表
     *
     * @param condition 查询条件
     * @return {@link List< StrategyContractAppVO>}
     * @since 2022/12/8 16:34
     */
    List<StrategyContractAppVO> appList(StrategyContractConditionDTO condition);

    /**
     * 查询用户当前策略
     *
     * @param userId 用户id
     * @return {@link StrategyContractAppDetailVO}
     * @since 2022/12/9 19:11
     */
    StrategyContractAppDetailVO appCurrent(Long userId);

    /**
     * 查询用户利润
     *
     * @return {@link StrategyContractProfitVO}
     * @since 2022/11/24 11:30
     */
    StrategyContractProfitVO profit();

	/**
	 * 查询指定用户利润
	 *
	 * @return {@link StrategyContractProfitVO}
	 * @since 2022/11/24 11:30
	 */
	StrategyContractProfitVO profit(Long userId);

}
